<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('student/index')}">班级列表</a></li>
        <li class="active"><a>添加班级</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form margin-top-20" action="{:url('student/addPost')}" method="post">
        <div class="form-group">
            <label class="col-sm-2 control-label">头像:</label>
            <div class="col-md-6 col-sm-10">
                <input id="photo-1" type="hidden" name="image" >
                <input id="photo-1-name" type="text" name="photo_name" title="图片名称">
                <img id="photo-1-preview" width="50px">
                <a href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a>
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>学生姓名</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="name">
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">性别:</label>
            <div class="col-md-6 col-sm-10">
                <input type="radio" name="sex" value="男" checked>男
                <input type="radio" name="sex" value="女">女
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">学生年龄</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-age" name="age">
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">手机号</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-moblie" name="moblie">
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">身份证号</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-idcard" name="idcard">
            </div>
        </div>
        <div class="form-group">
            <label for="school_id" class="col-sm-2 control-label">学校</label>
            <div class="col-md-6 col-sm-10">
                <select class="form-control" name="school_id" id="school_id">
                    <option value="" selected>请选择学校</option>
                    <foreach name="school" item="vo">
                        <option value="{$vo.id}">{$vo.name}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="school_id" class="col-sm-2 control-label">班级</label>
            <div class="col-md-6 col-sm-10">
                <select class="form-control" name="cid" id="room">
                    <option value="">请选择班级</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit" id="sub">添加</button>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js">
</script>
<script>
    $(function() {
        $('#school_id').change('click',function () {
            var schoolId=$('#school_id').val();
            $.ajax({
                url:"{:url('student/getRoombySchool')}",
                type:"POST",
                data:{school_id:schoolId},
                success:function(res){
                    console.log(res);
                    $('#room').html(res);
                }
            })
        })

    });
</script>

</body>
</html>